﻿/**
 * Scroller
 * ---------------------
 * VERSION: 1.0
 * DATE: 4/08/2010
 * AS3
 * UPDATES AND DOCUMENTATION AT: http://www.FreeActionScript.com
 * 
 * Scroller_link 链接到整个拉条内容的MC------>> org.nickro.project.Scroller_link
 * ScrollBar_link 链接到拉条MC------>> org.nickro.project.ScrollBar_link
 **/
package org.nickro.project
{
	import flash.display.MovieClip;
	import flash.events.Event;
	import org.nickro.greensock.TweenLite;
	
	public class Scroller_link extends MovieClip
	{			
		//content_mc  为文本内容  mask_mc 文本遮罩   scrollBar_mc 拉条
		private var content_mc_this:MovieClip;
		private var mask_mc_this:MovieClip;
		private var scrollBar_mc_this:MovieClip;	
		
		public function Scroller_link()
		{
			
			scrollBar_mc_this.addEventListener(ScrollBarEvent_link.VALUE_CHANGED, scrollBarMoved);
		}
		
		private function scrollBarMoved(event:ScrollBarEvent_link):void
		{
			var newY:Number = -event.scrollPercent * (content_mc_this.height - mask_mc_this.height);
			TweenLite.to(content_mc_this, 1, { y:newY } );
		}
	}
}
